/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author TANGQUOCTUAN
 */
@Entity
@Table(name = "OrderFoodDetails", catalog = "TUNGA", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "OrderFoodDetails.findAll", query = "SELECT o FROM OrderFoodDetails o"),
    @NamedQuery(name = "OrderFoodDetails.findAllByID", query = "SELECT o FROM OrderFoodDetails o WHERE o.oderFood.oderFoodID = :oderFoodID"),
    @NamedQuery(name = "OrderFoodDetails.findByQuantity", query = "SELECT o FROM OrderFoodDetails o WHERE o.quantity = :quantity"),
    @NamedQuery(name = "OrderFoodDetails.findByPrice", query = "SELECT o FROM OrderFoodDetails o WHERE o.price = :price"),
    @NamedQuery(name = "OrderFoodDetails.findByOrderDeatilsID", query = "SELECT o FROM OrderFoodDetails o WHERE o.orderDeatilsID = :orderDeatilsID")})
public class OrderFoodDetails implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "Quantity", nullable = false)
    private int quantity;
    @Basic(optional = false)
    @Column(name = "Price", nullable = false)
    private double price;
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Basic(optional = false)
    @Column(name = "OrderDeatilsID", nullable = false)
    private Integer orderDeatilsID;
    @JoinColumn(name = "OderFoodID", referencedColumnName = "OderFoodID", nullable = false)
    @ManyToOne(optional = false)
    private OderFood oderFood;
    @JoinColumn(name = "FoodID", referencedColumnName = "FoodID", nullable = false)
    @ManyToOne(optional = false)
    private Foods foods;

    public OrderFoodDetails() {
    }


    public OrderFoodDetails(int quantity, double price) {
        this.quantity = quantity;
        this.price = price;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    

    public Integer getOrderDeatilsID() {
        return orderDeatilsID;
    }

    public void setOrderDeatilsID(Integer orderDeatilsID) {
        this.orderDeatilsID = orderDeatilsID;
    }

    public OderFood getOderFood() {
        return oderFood;
    }

    public void setOderFood(OderFood oderFood) {
        this.oderFood = oderFood;
    }

    public Foods getFoods() {
        return foods;
    }

    public void setFoods(Foods foods) {
        this.foods = foods;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (orderDeatilsID != null ? orderDeatilsID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrderFoodDetails)) {
            return false;
        }
        OrderFoodDetails other = (OrderFoodDetails) object;
        if ((this.orderDeatilsID == null && other.orderDeatilsID != null) || (this.orderDeatilsID != null && !this.orderDeatilsID.equals(other.orderDeatilsID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.OrderFoodDetails[orderDeatilsID=" + orderDeatilsID + "]";
    }

}
